Skip to content

Commit a26a180

Browse files
http-client-java, generate and compile smoke test, fix POM, prepare patch 0.4.2 (#7145)
fix Azure/autorest.java#3110 tsp source from PR #6981 example POM ``` <project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>io.clientcore</groupId> <artifactId>tsptest-builtin</artifactId> <version>1.0.0-beta.1</version> <packaging>jar</packaging> <name>SDK for Builtin</name> <description>This package contains Builtin client library.</description> <url>https://github.com/Azure/azure-sdk-for-java</url> <licenses> <license> <name>The MIT License (MIT)</name> <url>http://opensource.org/licenses/MIT</url> <distribution>repo</distribution> </license> </licenses> <scm> <url>https://github.com/Azure/azure-sdk-for-java</url> <connection>scm:git:git@github.com:Azure/azure-sdk-for-java.git</connection> <developerConnection>scm:git:git@github.com:Azure/azure-sdk-for-java.git</developerConnection> <tag>HEAD</tag> </scm> <developers> <developer> <id>microsoft</id> <name>Microsoft</name> </developer> </developers> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>io.clientcore</groupId> <artifactId>core</artifactId> <version>1.0.0-beta.9</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.13.0</version> <configuration> <release>11</release> </configuration> </plugin> </plugins> </build> </project> ```
1 parent 352d9ab commit a26a180

File tree

6 files changed

+53
-56
lines changed

6 files changed

+53
-56
lines changed

packages/http-client-java/generator/http-client-generator-clientcore-test/Generate.ps1

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,19 @@ $generateScript = {
6060
}
6161
}
6262

63+
function Generate-Compile ($folder) {
64+
npx --no-install tsp compile "specs/$folder/main.tsp" --option "@typespec/http-client-java.emitter-output-dir={project-root}/$folder"
65+
66+
Push-Location $folder
67+
mvn package
68+
if ($LASTEXITCODE -ne 0) {
69+
throw "Failed to compile smoke test of $folder"
70+
}
71+
Pop-Location
72+
73+
Remove-Item $folder -Recurse -Force
74+
}
75+
6376
./Setup.ps1
6477

6578
Write-Host "Setup Complete"
@@ -102,6 +115,15 @@ if (Test-Path ./src/main/resources/META-INF/client-structure-service_apiview_pro
102115
Remove-Item ./src/main/resources/META-INF/client-structure-service_apiview_properties.json -Force
103116
}
104117

118+
# smoke test, generate Java project and verify compilation pass
119+
git fetch origin pull/6981/head:smoke-test-branch
120+
git restore --source smoke-test-branch --worktree -- ../../../smoke-http-specs
121+
Copy-Item -Path ../../../smoke-http-specs/specs -Destination ./ -Recurse -Force
122+
Generate-Compile todoapp
123+
Generate-Compile petstore
124+
Remove-Item ./specs -Recurse -Force
125+
Remove-Item ../../../smoke-http-specs -Recurse -Force
126+
105127
if ($ExitCode -ne 0) {
106128
throw "Failed to generate from tsp"
107129
}

packages/http-client-java/generator/http-client-generator-clientcore-test/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
"spector-stop": "tsp-spector server stop"
1313
},
1414
"dependencies": {
15-
"@typespec/spector": "0.1.0-alpha.13",
15+
"@typespec/spector": "0.1.0-alpha.14",
1616
"@typespec/spec-api": "0.1.0-alpha.6",
1717
"@typespec/http-specs": "0.1.0-alpha.22",
18-
"@typespec/http-client-java": "file:../../typespec-http-client-java-0.4.1.tgz",
18+
"@typespec/json-schema": "1.0.0",
19+
"@typespec/http-client-java": "file:../../typespec-http-client-java-0.4.2.tgz",
1920
"@typespec/http-client-java-tests": "file:"
2021
},
2122
"overrides": {

packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/clientcore/ClientCorePomTemplate.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ protected void writeRevapi(XmlBlock propertiesBlock, Pom pom) {
165165
* @param propertiesBlock The {@code <properties></properties>} XML block within the {@code pom.xml}.
166166
*/
167167
protected void writeSpotless(XmlBlock propertiesBlock) {
168-
// For now all generation will enable Spotless running.
169-
propertiesBlock.tag("spotless.skip", "false");
170168
}
171169

172170
/**
@@ -196,6 +194,9 @@ private void writePlugins(XmlBlock pluginsBlock) {
196194
pluginBlock.tag("groupId", "org.apache.maven.plugins");
197195
pluginBlock.tag("artifactId", "maven-compiler-plugin");
198196
pluginBlock.tag("version", "3.13.0");
197+
pluginBlock.block("configuration", configurationBlock -> {
198+
configurationBlock.tag("release", "11");
199+
});
199200

200201
// Generate annotation processor configuration if not using Rest Proxy
201202
if (!JavaSettings.getInstance().useRestProxy()) {

packages/http-client-java/generator/http-client-generator-test/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
"spector-stop": "tsp-spector server stop"
1313
},
1414
"dependencies": {
15-
"@typespec/spector": "0.1.0-alpha.13",
15+
"@typespec/spector": "0.1.0-alpha.14",
1616
"@typespec/spec-api": "0.1.0-alpha.6",
1717
"@typespec/http-specs": "0.1.0-alpha.22",
1818
"@azure-tools/azure-http-specs": "0.1.0-alpha.17",
19-
"@typespec/http-client-java": "file:../../typespec-http-client-java-0.4.1.tgz",
19+
"@typespec/http-client-java": "file:../../typespec-http-client-java-0.4.2.tgz",
2020
"@typespec/http-client-java-tests": "file:"
2121
},
2222
"overrides": {

packages/http-client-java/package-lock.json

Lines changed: 19 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/http-client-java/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@typespec/http-client-java",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "TypeSpec library for emitting Java client from the TypeSpec REST protocol binding",
55
"keywords": [
66
"TypeSpec"
@@ -73,14 +73,14 @@
7373
"@azure-tools/typespec-azure-resource-manager": "0.56.0",
7474
"@azure-tools/typespec-azure-rulesets": "0.56.0",
7575
"@azure-tools/typespec-client-generator-core": "0.56.1",
76-
"@typespec/spector": "0.1.0-alpha.13",
76+
"@typespec/spector": "0.1.0-alpha.14",
7777
"@microsoft/api-extractor": "^7.52.7",
7878
"@microsoft/api-extractor-model": "^7.30.6",
7979
"@types/js-yaml": "~4.0.9",
8080
"@types/lodash": "~4.17.16",
81-
"@types/node": "~22.15.14",
81+
"@types/node": "~22.15.17",
8282
"@typespec/compiler": "1.0.0",
83-
"@typespec/http": "1.0.0",
83+
"@typespec/http": "1.0.1",
8484
"@typespec/openapi": "1.0.0",
8585
"@typespec/rest": "0.70.0",
8686
"@typespec/versioning": "0.70.0",

0 commit comments

Comments
 (0)