-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- This (temporarily) removes the init template generation code until a non-nightly Gradle 8.11 is released that contains it. - It also updates kotlin to 1.9.24 to avoid build warnings about mismatched embedded versions.
- Loading branch information
Showing
9 changed files
with
15 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 2 additions & 22 deletions
24
...gin-android/src/main/java/org/gradle/api/experimental/buildinit/AndroidProjectSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,5 @@ | ||
package org.gradle.api.experimental.buildinit; | ||
|
||
import org.gradle.buildinit.projectspecs.InitProjectGenerator; | ||
import org.gradle.buildinit.projectspecs.InitProjectSource; | ||
import org.gradle.buildinit.projectspecs.InitProjectSpec; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* A {@link InitProjectSource} of project specifications for Android projects. | ||
*/ | ||
@SuppressWarnings("UnstableApiUsage") | ||
public final class AndroidProjectSource implements InitProjectSource { | ||
@Override | ||
public List<InitProjectSpec> getProjectSpecs() { | ||
return List.of( | ||
new StaticProjectSpec("android-application", "Declarative Android Application Project") | ||
); | ||
} | ||
|
||
@Override | ||
public Class<? extends InitProjectGenerator> getProjectGenerator() { | ||
return StaticProjectGenerator.class; | ||
} | ||
public final class AndroidProjectSource { | ||
// TODO: Restore this after updating to Gradle 8.11 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 2 additions & 28 deletions
30
...in-common/src/main/java/org/gradle/api/experimental/buildinit/StaticProjectGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,5 @@ | ||
package org.gradle.api.experimental.buildinit; | ||
|
||
import org.gradle.api.file.Directory; | ||
import org.gradle.buildinit.projectspecs.InitProjectConfig; | ||
import org.gradle.buildinit.projectspecs.InitProjectGenerator; | ||
import org.gradle.util.ResourceLoader; | ||
|
||
/** | ||
* An {@link InitProjectGenerator} that generates a project from a static template packaged | ||
* as resources files in the {@link #TEMPLATES_ROOT} directory. | ||
*/ | ||
@SuppressWarnings("UnstableApiUsage") | ||
public abstract class StaticProjectGenerator implements InitProjectGenerator { | ||
private static final String TEMPLATES_ROOT = "templates"; | ||
|
||
@Override | ||
public void generate(InitProjectConfig config, Directory projectDir) { | ||
if (!(config.getProjectSpec() instanceof StaticProjectSpec projectSpec)) { | ||
throw new IllegalArgumentException("Unknown project type: " + config.getProjectSpec().getDisplayName() + " (" + config.getProjectSpec().getClass().getName() + ")"); | ||
} | ||
|
||
String templatePath = TEMPLATES_ROOT + "/" + projectSpec.getTemplatePath(); | ||
ResourceLoader resourceLoader = new ResourceLoader(); | ||
|
||
try { | ||
resourceLoader.extractDirectoryFromResources(templatePath, projectDir.getAsFile()); | ||
} catch (Exception e) { | ||
throw new RuntimeException("Error extracting resources for: '" + projectSpec.getDisplayName() + "' from: '" + templatePath + "'!", e); | ||
} | ||
} | ||
public abstract class StaticProjectGenerator { | ||
// TODO: Restore this after updating to Gradle 8.11 | ||
} |
35 changes: 2 additions & 33 deletions
35
.../plugin-common/src/main/java/org/gradle/api/experimental/buildinit/StaticProjectSpec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,5 @@ | ||
package org.gradle.api.experimental.buildinit; | ||
|
||
import org.gradle.buildinit.projectspecs.InitProjectParameter; | ||
import org.gradle.buildinit.projectspecs.InitProjectSpec; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* An {@link InitProjectSpec} that represents a project that can be generated from a static template | ||
* using the {@link StaticProjectGenerator} | ||
*/ | ||
@SuppressWarnings("UnstableApiUsage") | ||
public final class StaticProjectSpec implements InitProjectSpec { | ||
private final String templatePath; | ||
private final String displayName; | ||
|
||
public StaticProjectSpec(String templatePath, String displayName) { | ||
this.templatePath = templatePath; | ||
this.displayName = displayName; | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return displayName; | ||
} | ||
|
||
@Override | ||
public List<InitProjectParameter<?>> getParameters() { | ||
return Collections.emptyList(); | ||
} | ||
|
||
public String getTemplatePath() { | ||
return templatePath; | ||
} | ||
public final class StaticProjectSpec { | ||
// TODO: Restore this after updating to Gradle 8.11 | ||
} |
24 changes: 2 additions & 22 deletions
24
...ugin/plugin-jvm/src/main/java/org/gradle/api/experimental/buildinit/JVMProjectSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,5 @@ | ||
package org.gradle.api.experimental.buildinit; | ||
|
||
import java.util.List; | ||
|
||
import org.gradle.buildinit.projectspecs.InitProjectGenerator; | ||
import org.gradle.buildinit.projectspecs.InitProjectSpec; | ||
import org.gradle.buildinit.projectspecs.InitProjectSource; | ||
|
||
/** | ||
* A {@link InitProjectSource} of project specifications for JVM projects. | ||
*/ | ||
@SuppressWarnings("UnstableApiUsage") | ||
public final class JVMProjectSource implements InitProjectSource { | ||
@Override | ||
public List<InitProjectSpec> getProjectSpecs() { | ||
return List.of( | ||
new StaticProjectSpec("java-application", "Declarative Java Application Project") | ||
); | ||
} | ||
|
||
@Override | ||
public Class<? extends InitProjectGenerator> getProjectGenerator() { | ||
return StaticProjectGenerator.class; | ||
} | ||
public final class JVMProjectSource { | ||
// TODO: Restore this after updating to Gradle 8.11 | ||
} |
24 changes: 2 additions & 22 deletions
24
...ugin/plugin-kmp/src/main/java/org/gradle/api/experimental/buildinit/KMPProjectSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,5 @@ | ||
package org.gradle.api.experimental.buildinit; | ||
|
||
import org.gradle.buildinit.projectspecs.InitProjectGenerator; | ||
import org.gradle.buildinit.projectspecs.InitProjectSource; | ||
import org.gradle.buildinit.projectspecs.InitProjectSpec; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* A {@link InitProjectSource} of project specifications for Kotlin (JVM) projects. | ||
*/ | ||
@SuppressWarnings("UnstableApiUsage") | ||
public final class KMPProjectSource implements InitProjectSource{ | ||
@Override | ||
public List<InitProjectSpec> getProjectSpecs() { | ||
return List.of( | ||
new StaticProjectSpec("kotlin-application", "Declarative Kotlin (JVM) Application Project") | ||
); | ||
} | ||
|
||
@Override | ||
public Class<? extends InitProjectGenerator> getProjectGenerator() { | ||
return StaticProjectGenerator.class; | ||
} | ||
public final class KMPProjectSource { | ||
// TODO: Restore this after updating to Gradle 8.11 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters