Skip to content

Commit

Permalink
Merge branch 'main' into tt/demo-android-project-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
big-guy authored Apr 15, 2024
2 parents e1c77ca + 7c000b4 commit ed0ebbb
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 22 deletions.
2 changes: 1 addition & 1 deletion unified-prototype/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\:https://services.gradle.org/distributions-snapshots/gradle-8.9-20240413002319+0000-bin.zip
distributionUrl=https\:https://services.gradle.org/distributions-snapshots/gradle-8.9-20240415150249+0000-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
androidApplication {
jdkVersion = 17
compileSdk = 34

versionCode = 8
versionName = "0.1.2"
applicationId = "org.gradle.experimental.android.application"
namespace = "org.gradle.experimental.android.application"

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@
import org.gradle.api.experimental.android.library.StandaloneAndroidLibraryPlugin;
import org.gradle.api.initialization.Settings;
import org.gradle.api.internal.SettingsInternal;
import org.gradle.api.internal.plugins.software.RegistersSoftwareTypes;
import org.gradle.plugin.software.internal.SoftwareTypeRegistry;

@RegistersSoftwareTypes({StandaloneAndroidApplicationPlugin.class, StandaloneAndroidLibraryPlugin.class})
public class AndroidEcosystemPlugin implements Plugin<Settings> {

@Override
public void apply(Settings target) {
// To be replaced with static annotations once https://github.com/gradle/gradle/pull/28736 is merged
SettingsInternal settings = (SettingsInternal) target;
SoftwareTypeRegistry softwareTypeRegistry = settings.getServices().get(SoftwareTypeRegistry.class);
softwareTypeRegistry.register(StandaloneAndroidApplicationPlugin.class);
softwareTypeRegistry.register(StandaloneAndroidLibraryPlugin.class);
}
public void apply(Settings target) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.gradle.api.experimental.android.application;

import com.android.build.api.dsl.ApplicationBaseFlavor;
import com.android.build.api.dsl.BaseFlavor;
import com.android.build.api.dsl.CommonExtension;
import org.gradle.api.Action;
Expand All @@ -27,6 +28,27 @@

@Restricted
public interface AndroidApplication {

/**
* @see ApplicationBaseFlavor#setVersionName(String)
*/
@Restricted
Property<String> getVersionName();


/**
* @see ApplicationBaseFlavor#setVersionCode(Integer)
*/
@Restricted
Property<Integer> getVersionCode();


/**
* @see ApplicationBaseFlavor#setApplicationId(String)
*/
@Restricted
Property<String> getApplicationId();

/**
* @see CommonExtension#getCompileSdk()
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public static void linkDslModelToPlugin(Project project, AndroidApplication dslM
ifPresent(dslModel.getCompileSdk(), android::setCompileSdk);
android.defaultConfig(defaultConfig -> {
ifPresent(dslModel.getMinSdk(), defaultConfig::setMinSdk);
ifPresent(dslModel.getVersionCode(), defaultConfig::setVersionCode);
ifPresent(dslModel.getVersionName(), defaultConfig::setVersionName);
ifPresent(dslModel.getApplicationId(), defaultConfig::setApplicationId);
return null;
});
ifPresent(dslModel.getJdkVersion(), jdkVersion -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@
import org.gradle.api.experimental.java.StandaloneJavaLibraryPlugin;
import org.gradle.api.initialization.Settings;
import org.gradle.api.internal.SettingsInternal;
import org.gradle.api.internal.plugins.software.RegistersSoftwareTypes;
import org.gradle.plugin.software.internal.SoftwareTypeRegistry;

@RegistersSoftwareTypes({StandaloneJavaApplicationPlugin.class, StandaloneJavaLibraryPlugin.class, StandaloneJvmLibraryPlugin.class})
public class JvmEcosystemPlugin implements Plugin<Settings> {
@Override
public void apply(Settings target) {
// To be replaced with static annotations once https://github.com/gradle/gradle/pull/28736 is merged
SettingsInternal settings = (SettingsInternal) target;
SoftwareTypeRegistry softwareTypeRegistry = settings.getServices().get(SoftwareTypeRegistry.class);
softwareTypeRegistry.register(StandaloneJavaApplicationPlugin.class);
softwareTypeRegistry.register(StandaloneJavaLibraryPlugin.class);
softwareTypeRegistry.register(StandaloneJvmLibraryPlugin.class);
}
public void apply(Settings target) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
import org.gradle.api.Plugin;
import org.gradle.api.initialization.Settings;
import org.gradle.api.internal.SettingsInternal;
import org.gradle.api.internal.plugins.software.RegistersSoftwareTypes;
import org.gradle.plugin.software.internal.SoftwareTypeRegistry;


@RegistersSoftwareTypes(StandaloneKmpLibraryPlugin.class)
public class KmpEcosystemPlugin implements Plugin<Settings> {
@Override
public void apply(Settings target) {
// To be replaced with static annotations once https://github.com/gradle/gradle/pull/28736 is merged
SettingsInternal settings = (SettingsInternal) target;
SoftwareTypeRegistry softwareTypeRegistry = settings.getServices().get(SoftwareTypeRegistry.class);
softwareTypeRegistry.register(StandaloneKmpLibraryPlugin.class);
}
public void apply(Settings target) { }
}

0 comments on commit ed0ebbb

Please sign in to comment.