Skip to content

Commit

Permalink
Make Hilt Android Gradle Plugin a multi-module Gradle project
Browse files Browse the repository at this point in the history
RELNOTES=n/a
PiperOrigin-RevId: 449455077
  • Loading branch information
java-team-github-bot authored and Dagger Team committed May 18, 2022
1 parent 7a3e0a8 commit e1aa9c0
Show file tree
Hide file tree
Showing 68 changed files with 137 additions and 20 deletions.
2 changes: 1 addition & 1 deletion java/dagger/hilt/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ filegroup(
"//java/dagger/hilt/android/internal/modules:srcs_filegroup",
"//java/dagger/hilt/android/lifecycle:srcs_filegroup",
"//java/dagger/hilt/android/migration:srcs_filegroup",
"//java/dagger/hilt/android/plugin:srcs_filegroup",
"//java/dagger/hilt/android/plugin/main:srcs_filegroup",
"//java/dagger/hilt/android/qualifiers:srcs_filegroup",
"//java/dagger/hilt/android/scopes:srcs_filegroup",
],
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dagger.hilt.android.plugin

import dagger.hilt.android.plugin.util.isClassFile
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2022 The Dagger Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dagger.hilt.android.plugin

import com.android.build.api.instrumentation.AsmClassVisitorFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dagger.hilt.android.plugin

/** Configuration options for the Hilt Gradle Plugin */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dagger.hilt.android.plugin.task

import dagger.hilt.android.plugin.AndroidEntryPointClassTransformer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2022 The Dagger Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dagger.hilt.android.plugin.util

import org.gradle.api.artifacts.transform.CacheableTransform
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2022 The Dagger Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dagger.hilt.android.plugin.util

import java.io.File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2022 The Dagger Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dagger.hilt.android.plugin.util

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2022 The Dagger Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dagger.hilt.android.plugin.util

import org.gradle.api.Project
import org.gradle.api.tasks.TaskProvider
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

/**
* Gets [KotlinCompile] task of an Android variant.
*/
@Suppress("UNCHECKED_CAST")
internal fun getCompileKotlin(
@Suppress("DEPRECATION") variant: com.android.build.gradle.api.BaseVariant,
project: Project
) = project.tasks.named(
"compile${variant.name.capitalize()}Kotlin"
) as TaskProvider<KotlinCompile>
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2022 The Dagger Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package util

import com.google.common.truth.Truth.assertThat
Expand Down
18 changes: 18 additions & 0 deletions java/dagger/hilt/android/plugin/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (C) 2022 The Dagger Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

rootProject.name = 'hilt-gradle-plugin'
include 'main'

This file was deleted.

6 changes: 3 additions & 3 deletions util/deploy-hilt-gradle-plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ _deploy_plugin() {
local plugindir=java/dagger/hilt/android/plugin
./$plugindir/gradlew -p $plugindir --no-daemon clean \
publishAllPublicationsToMavenRepository -PPublishVersion="$VERSION_NAME"
local outdir=$plugindir/build/repo/com/google/dagger/hilt-android-gradle-plugin/$VERSION_NAME
local markerOutDir=$plugindir/build/repo/com/google/dagger/hilt/android/com.google.dagger.hilt.android.gradle.plugin/$VERSION_NAME
local outdir=$plugindir/main/build/repo/com/google/dagger/hilt-android-gradle-plugin/$VERSION_NAME
local markerOutDir=$plugindir/main/build/repo/com/google/dagger/hilt/android/com.google.dagger.hilt.android.gradle.plugin/$VERSION_NAME
# When building '-SNAPSHOT' versions in gradle, the filenames replaces
# '-SNAPSHOT' with timestamps, so we need to disambiguate by finding each file
# to deploy. See: https://stackoverflow.com/questions/54182823/
Expand All @@ -38,4 +38,4 @@ _deploy_plugin() {
}

# Gradle Plugin is built with Gradle, but still deployed via Maven (mvn)
_deploy_plugin
_deploy_plugin

0 comments on commit e1aa9c0

Please sign in to comment.